<%
'先定义
Dim UserID			
Dim UserName		
Dim UserPassword	
Dim Reg_Date		
Dim Reg_IP			
Dim Last_LoginDate	
Dim Last_LoginIP	
Dim Locked			
Dim Login_Times		
Dim Member_Type
Sub Member_Edit()

	UserID = reform("UserID")
	Locked = reform("Locked")

	Call Check_IsNumeric(UserID)

	If Request.Form("password")<>"" Then
		UserPassword = MD5(Request.Form("password"))
	Else
		UserPassword = ""
	End if	

	If UserPassword="" Then 
		Sql = "UPDATE Member SET "&_
			  " Locked = "&Locked&_
			  " WHERE UserID="&UserID
	Else
		Sql = "UPDATE Member SET "&_
			  " Locked = "&Locked&_
			  " ,UserPassword = '"&UserPassword&"'"&_
			  " WHERE UserID="&UserID

	End If 
	conn.execute(Sql)
	
	AlertBox "用户资料修改成功！","Member_Query.asp"

End Sub

Sub Member_Del()


	UserID = Reform("OP_ID")
	

	sql = "DELETE FROM  Member WHERE UserID IN ("&UserID&")"

	Call Db_Execute("用户删除！",Sql,"Member_Query.asp")	

End Sub

Sub Get_Member_Info()
	UserID = requery("UserID")
	Call Check_IsNumeric(UserID)
	sql = "SELECT * FROM Member WHERE UserID = " &UserID
	Set rs = conn.execute(sql)
	If Not rs.eof Then
		UserName = rs("UserName")		
		UserPassword = rs("UserPassword")	
		Reg_Date = rs("Reg_Date")		
		Reg_IP = rs("Reg_IP")			
		Last_LoginDate = rs("Last_LoginDate")	
		Last_LoginIP = rs("Last_LoginIP")	
		Locked = rs("Locked")			
		Login_Times = rs("Login_Times")	
		Member_Type = rs("Member_Type")
	End If
	If Member_Type="个人" Then 
		Call Get_Member_Personal_Info(UserName)
	Else
		Call Get_Member_Corp_Info(UserName)
	End If 

End Sub 


Dim Email	
Dim TrueName
Dim Tel		
Dim Photo	
Dim Age		
Dim Sex		
Dim Address	

Sub Get_Member_Personal_Info(UserName)
	sql = "SELECT * FROM Member_Personal WHERE UserName = '" &UserName&"'"
	Set rs = conn.execute(sql)
	If Not rs.eof Then
		Email = rs("Email")	
		TrueName = rs("TrueName")
		Tel = rs("Tel")		
		Photo = rs("Photo")	
		Age = rs("Age")		
		Sex = rs("Sex")		
		Address = rs("Address")	
	End If

End Sub 


Dim Corp_ID
Dim Corp_Name	
Dim Open_Time	
Sub Get_Member_Corp_Info(UserName)
	sql = "SELECT * FROM Member_Corp WHERE UserName = '" &UserName&"'"
	Set rs = conn.execute(sql)
	If Not rs.eof Then
		Corp_Name = rs("Corp_Name")	
		Email = rs("Email")		
		Tel = rs("Tel")			
		Photo = rs("Photo")		
		Address = rs("Address")		
		Open_Time = rs("Open_Time")	
	End If
	rs.close

	sql = "SELECT ID,Corp_Name FROM Corp_Info WHERE Corp_Username = '" &UserName&"'"
	Set rs = conn.execute(sql)
	If Not rs.eof Then
		Corp_ID = rs("ID")	
		Corp_Name = rs("Corp_Name")		
	End If
	
End Sub 
Sub Set_Corp_Name()

	Corp_ID		= reform("Corp_ID")
	Corp_Name	= reform("Corp_Name")
	UserName	= reform("UserName")
	
	Call Check_IsNumeric(Corp_ID)


	Sql = "UPDATE Corp_Info SET "&_
		  " Corp_Username = '"&UserName&"'"&_
		  " WHERE ID="&Corp_ID

	conn.execute(Sql)
	
	AlertBox "用户资料修改成功！","Member_Query.asp"

End Sub

%>
